package com.example.demo.util.dict;

import com.example.demo.util.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
//@Component
public class DaoDictAspect {

    @Pointcut("execution(* com.baomidou.mybatisplus.extension.service..*.*(..))")
    public void doPointcut() {
    }

    @AfterReturning(pointcut = "doPointcut()", returning = "result")
    public void doAfterReturning(JoinPoint pjp, Object result) {
        try {
            DictUtils.convertDict(result);
        } catch (Exception e) {
            log.error("TbFlowsDAO查询结果字典转换失败", e);
        }
    }

}
